<template>
    <el-form :inline="true" :model="formdata" ref="form">
        <el-form-item v-for="item in formtype" :key="item.label" :label="item.label">
            <el-input v-if="item.type == 'input'" :placeholder="`请输入${item.label}`" v-model="formdata[item.prop]" ></el-input>
            <el-select v-if="item.type == 'select'" :placeholder="`请选择${item.label}`" v-model="formdata[item.prop]">
                <el-option v-for="(option) in item.options"
                :key="option.label"
                :label="option.label"
                :value="option.value">
                </el-option>
            </el-select>
            <el-date-picker v-if="item.type == 'datepicker'" 
            value-format="yyyy-MM-dd"
            placeholder="选择日期"
            type="date"
            v-model="formdata[item.prop]"
            >
            </el-date-picker>
        </el-form-item>
        <el-form-item><slot></slot></el-form-item>
    </el-form>
</template>

<script>
export default {
    name:'CommonForm',
    props:{
        formtype:{},
        formdata:{}
    },
    data(){
        return {}
    }
}
</script>

<style>

</style>